The behavior of an application program is often analyzed based on sampling logs that are collected by causing a processor to generate intermittent interrupts during execution of the application program. For example, in some cases, a processor having a function of generating interrupts at regular intervals executes an application program, and collects status information, such as the instruction address of an instruction that is being executed and the like, as a sampling log each time an interrupt is generated.
This method of analyzing the behavior of an application program is often called “profiling using time-based sampling”. With the “profiling using time-based sampling”, it is possible to figure out the execution order of program modules and the time taken for execution, by arranging collected sampling logs in time series, for example.
As an example of such a technique, there has been proposed an analysis apparatus that analyzes the call status of functions contained in an application program. The proposed analysis apparatus causes the processor to generate an interrupt at predetermined intervals during execution of an application program. Each time an interrupt is generated, the analysis apparatus collects a function call record including the address of a function that is being called, from the stack area of the memory. The analysis apparatus displays time-series information indicating when each function is called, based on the collected function call records. Further, the analysis apparatus counts and displays the number of times each function is called, based on the collected function call records.
See, for example, Japanese Laid-open Patent Publication No. 2000-250780.
If sampling logs are collected at shorter intervals, it is possible to analyze the behavior of an application program in greater detail. However, it is sometimes difficult to reduce the length of the sampling interval due to limitations of computational resources. Further, if the sampling interval is too short, the behavior of the application program is likely to be different from the original behavior due to the load of sampling itself. Therefore, in many cases, sampling logs are collected at sufficient intervals.
However, even if intermittent sampling logs are arranged in order of time of sampling, useful analysis results are not likely to be obtained for the loop contained in the application program. This is because the repetition interval of loop processing is highly likely to be shifted from the sampling interval, and each of the sampling logs collected during execution of the loop merely indicates an arbitrary one of the instructions that are executed in the loop.
For example, consider an application program that sequentially calls functions f1, f2, and f3 in a loop. When a process inside the loop iterates, the functions f1, f2, and f3 are repeatedly called. If sampling logs are intermittently collected during execution of the loop, there may be a case where the function f1 is being executed at the first sampling time; the function f3 is being executed at the second sampling time; the function f2 is being executed at the third sampling time; and the function f2 is being executed at the fourth sampling time. However, the analysis result in which the functions that are being executed are arranged in order of sampling time, that is, in order of f1, f3, f2, f2 and so on does not represent either the order in which the functions are called in the loop, or the time taken to execute the functions f1, f2, and f3.